//
//  UIBarButtonItem+Extensions.swift
//  WeiBo
//
//  Created by lihaixing on 2018/12/11.
//  Copyright © 2018年 lihaixing. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    
    convenience init(title:String,fontSize:CGFloat=16,target:AnyObject,action:Selector,isBack:Bool=false) {
        let btn:UIButton=UIButton.cz_textButton(title, fontSize: fontSize, normalColor: UIColor.gray, highlightedColor: UIColor.orange)
        btn .addTarget(target, action:action , for: .touchUpInside)
        if isBack {
            let imageName = "navigationbar_back_withtext";
            let imageNormal=UIImage.init(named: imageName)
            let imageHigh=UIImage.init(named: imageName+"_highlighted")
            btn.setImage(imageNormal, for: .normal)
            btn.setImage(imageHigh, for: .highlighted)
            btn.sizeToFit()
        }
        self.init(customView: btn)
    }
}
